package com.semidata.rtd.engine.dynamic;

import java.io.ByteArrayOutputStream;
import java.net.URI;

import javax.tools.SimpleJavaFileObject;

public class ClassObjectInMemory extends SimpleJavaFileObject {
	private final ByteArrayOutputStream out = new ByteArrayOutputStream();

	public ClassObjectInMemory(String name) {
		super(URI.create("memo:///" + name.replace('.', '/')
				+ Kind.CLASS.extension), Kind.CLASS);
	}

	public byte[] toByteArray() {
		return this.out.toByteArray();
	}

	@Override
	public ByteArrayOutputStream openOutputStream() {
		return this.out;
	}
}
